<include file="public@header" />
</head>
<body>
    <div class="layui-fluid">
        <form method="post" class="layui-form js-ajax-form margin-top-20" action="{:url('link/addPost')}">
            <div class="layui-card">
                <div class="layui-card-header">{:lang('ADMIN_LINK_ADD')}</div>
                    <div class="layui-card-body">
                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('LINK_NAME')}</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="name">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('CATEGORY')}</label>
                            <div class="layui-input-block">
                                <select class="layui-input" name="cat_id" id="more-template-select">
                                    {$catOptions}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('LINK_URL')}</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" id="input-url" name="url" placeholder="http://">
                            </div>
                        </div>

                        <if condition="$type eq 2">
                            <div class="layui-form-item">
                                <label class="layui-form-label">{:lang('UPLOAD_IMAGE')}</label>
                                <div class="layui-input-block">
                                    <div class="upload-image">
                                        <input type="hidden" name="image" id="thumbnail" value="">
                                        <a href="javascript:uploadOneImage('{:lang('UPLOAD_IMAGE')}','#thumbnail');">
                                            <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                                 id="thumbnail-preview"
                                                 width="135"/>
                                        </a>
                                        <input type="button" class="layui-btn layui-btn-danger layui-btn-md" onclick="$('#thumbnail-preview').attr('src','__TMPL__/public/assets/images/default-thumbnail.png');$('#thumbnail').val('');return false;" value="{:lang('CANCEL_PICTURE')}">
                                    </div>
                                </div>
                            </div>
                        </if>

                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('LINK_TARGET')}</label>
                            <div class="layui-input-block">
                                <select class="layui-input" name="target" id="input-target">
                                    <foreach name="targets" item="vo">
                                        <option value="{$key}">{$vo}</option>
                                    </foreach>
                                </select>
                            </div>
                        </div>
                        <!-- <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('DESCRIPTION')}</label>
                            <div class="layui-input-block">
                                <textarea class="layui-input" name="description"></textarea>
                            </div>
                        </div> -->

                        <!-- 排序号 -->
                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('SORT')}</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="list_order" value="50">
                            </div>
                        </div>
                        <!-- 属性 -->
                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('ATTRIBUTE')}</label>
                            <div class="layui-input-block">
                                <input type="checkbox" id="status" name="status" value="0" title="{:lang('IS_HIDE')}">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <input type="hidden" name="type" value="{$type}">
                                <if condition="cmf_auth_check(cmf_get_current_admin_id(), 'admin/Link/addPost')">
                                    <button type="submit" class="layui-btn layui-btn-normal js-ajax-submit">{:lang('ADD')}</button>
                                </if>
                                <a class="layui-btn layui-btn-primary" href="javascript:history.back(-1);">{:lang('BACK')}</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
<include file="public@footer"/>
